package com.diu.domain.strategy.repository;

import com.diu.domain.strategy.model.entity.StrategyAwardEntity;
import com.diu.domain.strategy.model.entity.StrategyEntity;
import com.diu.domain.strategy.model.entity.StrategyRuleEntity;
import com.diu.domain.strategy.model.vo.StrategyAwardRuleModelVO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author diu
 * @description 策略仓储库，负责存储策略计算结果
 * @create_time 2025/10/3 17:06
 */
public interface IStrategyRepository {

    /**
     * 查找策略
     *
     * @param strategyId 策略ID
     */
    List<StrategyAwardEntity> queryStrategyAwardList(Long strategyId);

     /**
      * 保存策略奖品概率查找表
      *
      * @param key 策略ID
      * @param strategyAwardSearchTableSize 策略奖品查找表大小
      * @param strategyAwardSearchTable 策略奖品列表
      */
     void storeStrategyAwardSearchRateTable(String key, Integer strategyAwardSearchTableSize, Map<Integer, Integer> strategyAwardSearchTable);

     void storeStrategyAwardSearchRateTableOwn(String key, Integer strategyAwardSearchTableSize, Map<BigDecimal, Integer> strategyAwardSearchTable, BigDecimal totalRate);

     /**
      * 获取策略奖品概率范围
      *
      * @param key 策略ID
      * @return 策略奖品概率范围
      */
     BigDecimal getRateRange(String key);

     /**
      * 获取策略奖品装配状态
      *
      * @param strategyId 策略ID
      * @param rateRange 随机抽奖数
      * @return 返回抽到的奖品ID
      */
     Integer getStrategyAwardAssemble(Long strategyId, int rateRange);

     Integer getStrategyAwardAssembleOwn(String key, BigDecimal rateRange);

     /**
      * 查询策略
      *
      * @param strategyId 策略ID
      * @return 策略实体
      */
     StrategyEntity queryStrategyByStrategyId(Long strategyId);

     StrategyRuleEntity queryStrategyRuleByStrategyId(Long strategyId);

     /**
      * 查询策略
      *
      * @param strategyId 策略ID
      * @param ruleModel 规则模型
      * @return 策略实体
      */
     StrategyRuleEntity queryStrategyRuleByStrategyIdAndRuleModel(Long strategyId, String ruleModel);

     /**
      * 查询策略奖品列表
      *
      * @param strategyId 策略ID
      * @param awardId 奖品ID
      * @return 策略奖品实体列表
      */
     StrategyAwardEntity queryStrategyAwardListByStrategyAndAwardId(Long strategyId, Integer awardId);
        /**
        * 查询策略规则值
        *
        * @param strategyId 策略ID
        * @param ruleModel 规则模型
        * @return 规则值
        */
     String queryStrategyRuleValue(Long strategyId, Integer awardId, String ruleModel);

     StrategyEntity queryStrategyEntityByStrategyId(Long strategyId);

     StrategyAwardRuleModelVO queryStrategyAwardRuleModel(Long strategyId, Integer awardId);


}
